#ifndef _WMI_REGISTRY_H
#define _WMI_REGISTRY_H

/******************************************************************************
** @file	wmi_registry.h
** @author	Marco Galvez 
** @date	Jul 25, 2010
**
** @desc	This class represents a Windows Registry. It also has a
**			HiveEnumerator with the 5 constans of the Registry 
**			
**
******************************************************************************/

#include <string>
#include <vector>
#include <iostream>
#include "wmi_value.h"
#include "wmi_iwinobject.h"
#include "wmi_constants.h"
#include <log4cxx\logger.h>
#include <log4cxx\xml\domconfigurator.h>
#include "wmi_common.h"

/*
* Hive enum is an enumerator that represents the 5 hive registrys of windows 
*
*/
enum HiveEnum { 
	R_CLASSES_ROOT,
	R_CURRENT_USER, 
	R_LOCAL_MACHINE, 
	R_USERS,
	R_CURRENT_CONFIG, 
	R_DYN_DATA 
};

class SOEXPORT WMI_Registry : public WMI_IWinObject
{
public:
	/**
	* Constructor of WRegistryClass
	*
	* @param root, it's a HiveEnum it represents a Hive of the registry for example HKEY_CLASSES_ROOT
	* @param name, a wstring it is the name that the objet will have
	* @param subKey, a wstring that represents a subKey of the resgitry 
	*/
	WMI_Registry(  std::wstring name,std::wstring path);

	/**
	* Copy Constructor
	* @param registry, a WMI_Registry that provides the data to create a ne object
	*/
	WMI_Registry(const WMI_Registry& registry);

	/**
	* Default Constructor
	*/
	WMI_Registry();

	/**
	* Destructor
	*/
	~WMI_Registry();

	/*
	* This method returns the name of the registry
	* @return wstring with the name of the registry
	*/
	std::wstring& 
	WMI_Registry::getName()
	{
		return _name;
	}

	/*
	* Sets a new name to a registry, the old name will be lost
	* @param name, a wstring with the nw name
	*/
	void 
	WMI_Registry::setName(std::wstring& name)
	{
		_name=name;
	}

	/*
	* This method returns the path to access to the registry
	* @return  wstring,  return a wstring with the path
	*/
	std::wstring& 
	WMI_Registry::getPath()
	{
		return _path;
	}

	/*
	* This method sets the path of the registry
	* @param return a wstring with the path
	*/
	void 
	WMI_Registry::setPath(std::wstring& path)
	{
		_path=path;
	}

	/*
	* Returns a stl vector with the children registrys
	* @return a stl vector<WMI_Registry>
	*/
	std::vector<WMI_Registry*>& 
	WMI_Registry::getRegistryList()
	{
		return _registryList;
	}

    /*
	* Returns a stl vector with the values of registries
	* @return a stl vector<WMI_Value>
	*/
	std::vector<WMI_Value>&
	WMI_Registry::getValueList()
	{
		return _valueList;
	}

	/*
	* Adds a new children to the current registry
	* @param WMI_Registry*, is the children to add
	*/
	void 
	WMI_Registry::addRegistry(WMI_Registry *registry);

	/*
	* Adds a new value to the current registry
	* @param WMI_Value, is the value to add
	*/
	void 
	WMI_Registry::addValue(WMI_Value& value);

	/*
	* Prints the name of the registry, its values and also its childrens
	*/
	void 
	WMI_Registry::print();
	
	/*
	* operator = overloaded, 
	*/
	WMI_Registry& operator= (const WMI_Registry& registry);

private:
    /*
	* Holds the path to access to the registry
    */    
	std::wstring _name;

    /*
	* Holds the name to a registry
    */
	std::wstring _path;

    /*
	* Holds a set of WMI_Registry objects
    */
	std::vector<WMI_Registry*> _registryList;

    /*
	* Holds a set of WMI_Value objects
    */
	std::vector<WMI_Value> _valueList;
};

#endif